<?php

/**
 * This file is part of the Pagizer package.
 *
 * For the full copyright and license information, please view the LICENSE
 * file that was distributed with this source code.
 *
 * @copyright   Copyright (c) 2010 Advisa (http://www.advisa.fr)
 * @author      Pagizer Core Team <team@pagizer.org>
 * @package     pagizer
 * @subpackage  users
 */

class m_users_forms_checkers_checkGroupName extends f_form_Checker
{
	public function check()
	{		
		$documentProvider = f_document_Provider::getInstance();
		$data = $documentProvider
						->loadDocuments("modules_users/group")
						->whereIsEqual("document_label", $this->getValue())
						->retrieveDocuments();
		
		if($data) 
		{
			return $this->getErrorMessage();
		}
		
		return true;
	}
}